$(function () {
    //过滤编辑页面
    if (window.location.href.indexOf("addOrEdit?id=") === -1) {
        var select = $("select");
        $.each(select, function (i, v) {
            var name = $(v).attr("name"), n = localStorage.getItem(name);
            if (n) {
                $("select[name='" + name + "'] option").eq(n).prop('selected', true);
            }
        })

        $("select").on('change', function () {
            var name = $(this).attr("name");
            localStorage.setItem(name, $('option:selected', this).index());
        });
    }
    if ($("select.select2")[0]) {
        var a = $(".select2-parent")[0] ? $(".select2-parent") : $("body");
        $("select.select2").select2({
            dropdownAutoWidth: !0,
            width: "100%",
            dropdownParent: a
        })
    }


})
$(".datetime-picker")[0] && $(".datetime-picker").flatpickr({
    enableTime: !0,
    nextArrow: '<i class="zmdi zmdi-long-arrow-right" />',
    prevArrow: '<i class="zmdi zmdi-long-arrow-left" />'
});

$(".date-picker")[0] && $(".date-picker").flatpickr({
    enableTime: !1,
    nextArrow: '<i class="zmdi zmdi-long-arrow-right" />',
    prevArrow: '<i class="zmdi zmdi-long-arrow-left" />'
});

$(".time-picker")[0] && $(".time-picker").flatpickr({
    noCalendar: !0,
    enableTime: !0
});
